Capsule API Example
Loading...
Searching...
No Matches
CDeviceLocator.h File Reference
#include "CDefinesPrivate.h"
#include "CDeviceInfoList.h"
#include "CError.h"

Go to the source code of this file.

Typedefs

typedef enum clCDeviceLocator_FailReason clCDeviceLocator_FailReason
 Device locator error.
 
typedef enum clCCapsule_LogLevel clCCapsule_LogLevel
 
typedef void(* clCDeviceLocator_DeviceListHandler) (clCDeviceLocator, clCDeviceInfoList, clCDeviceLocator_FailReason) NOEXCEPT
 Device callback for the list of device info.
 

Enumerations

enum  clCDeviceLocator_FailReason { clCDeviceLocator_FailReason_OK = 0 , clCDeviceLocator_FailReason_BluetoothDisabled , clCDeviceLocator_FailReason_Unknown }
 Device locator error. More...
 
enum  clCCapsule_LogLevel {
  clCCapsule_LogLevel_Trace , clCCapsule_LogLevel_Debug , clCCapsule_LogLevel_Info , clCCapsule_LogLevel_Warn ,
  clCCapsule_LogLevel_Err , clCCapsule_LogLevel_Critical , clCCapsule_LogLevel_Off
}
 

Functions

CL_DLL const char * clCCapsule_GetVersionString () NOEXCEPT
 
CL_DLL void clCCapsule_SetSingleThreaded (bool singleThreaded) NOEXCEPT
 
CL_DLL void clCCapsule_SetLogLevel (clCCapsule_LogLevel logLevel) NOEXCEPT
 
CL_DLL clCCapsule_LogLevel clCCapsule_GetLogLevel () NOEXCEPT
 
 CLC_CLASS_WN (DeviceLocatorPrivate, clCDeviceLocator)
 Device locator.
 
CL_DLL clCDeviceLocator clCDeviceLocator_Create (clCError *error) NOEXCEPT
 
CL_DLL clCDeviceLocator clCDeviceLocator_CreateWithLogDirectory (const char *logDirectory, clCError *error) NOEXCEPT
 
CL_DLL void clCDeviceLocator_Update (clCDeviceLocator locator) NOEXCEPT
 
CL_DLL void clCDeviceLocator_Destroy (clCDeviceLocator locator) NOEXCEPT
 
CL_DLL void clCDeviceLocator_RequestDevices (clCDeviceLocator locator, clCDeviceType deviceType, int32_t searchTime, clCError *error) NOEXCEPT
 Find available devices. Search time is in seconds. Searches for available devices of chosen type. Non-blocking - OnDevices event is fired when timeout expires.
 
CL_DLL void clCDeviceLocator_StopScanning (clCDeviceLocator locator, clCError *error) NOEXCEPT
 Stop scanning for devices. OnDevices event may not be fired.
 
CL_DLL void clCDeviceLocator_SetOnDeviceListEvent (clCDeviceLocator locator, clCDeviceLocator_DeviceListHandler handler) NOEXCEPT
 

Typedef Documentation

◆ clCCapsule_LogLevel

◆ clCDeviceLocator_DeviceListHandler

typedef void(* clCDeviceLocator_DeviceListHandler) (clCDeviceLocator, clCDeviceInfoList, clCDeviceLocator_FailReason) NOEXCEPT

Device callback for the list of device info.

◆ clCDeviceLocator_FailReason

Device locator error.

Enumeration Type Documentation

◆ clCCapsule_LogLevel

Enumerator
clCCapsule_LogLevel_Trace 
clCCapsule_LogLevel_Debug 
clCCapsule_LogLevel_Info 
clCCapsule_LogLevel_Warn 
clCCapsule_LogLevel_Err 
clCCapsule_LogLevel_Critical 
clCCapsule_LogLevel_Off 

◆ clCDeviceLocator_FailReason

Device locator error.

Enumerator
clCDeviceLocator_FailReason_OK 

No error.

clCDeviceLocator_FailReason_BluetoothDisabled 

Bluetooth adapter not found or disabled.

clCDeviceLocator_FailReason_Unknown 

Unknown error.

Function Documentation

◆ CLC_CLASS_WN()

CLC_CLASS_WN ( DeviceLocatorPrivate ,
clCDeviceLocator  )

Device locator.

◆ clCCapsule_GetLogLevel()

CL_DLL clCCapsule_LogLevel clCCapsule_GetLogLevel ( )

Get current filter log level of Capsule

Returns
log level

◆ clCCapsule_GetVersionString()

CL_DLL const char * clCCapsule_GetVersionString ( )

◆ clCCapsule_SetLogLevel()

CL_DLL void clCCapsule_SetLogLevel ( clCCapsule_LogLevel logLevel)

Set log level to filter Capsule's log messages

◆ clCCapsule_SetSingleThreaded()

CL_DLL void clCCapsule_SetSingleThreaded ( bool singleThreaded)

By default Capsule API operates in multi threaded mode - event callbacks are fired in a background thread. Call this function once before working with Capsule to initiate single-thread mode. In order for Capsule to work in this mode, clCDeviceLocator_Update must be called periodically on the main thread. The event callbacks will be called inside clCDeviceLocator_Update.

◆ clCDeviceLocator_Create()

CL_DLL clCDeviceLocator clCDeviceLocator_Create ( clCError * error)

Create device locator. Log files will not be created

Parameters
errorout error parameter
Returns
device locator handle

◆ clCDeviceLocator_CreateWithLogDirectory()

CL_DLL clCDeviceLocator clCDeviceLocator_CreateWithLogDirectory ( const char * logDirectory,
clCError * error )

Create device locator with directory to store log files of Capsule

Parameters
errorout error parameter
logDirectorypath to a folder where Capsule logs will be stored
Returns
device locator handle

◆ clCDeviceLocator_Destroy()

CL_DLL void clCDeviceLocator_Destroy ( clCDeviceLocator locator)

Release device locator.

Parameters
locatordevice locator handle

◆ clCDeviceLocator_RequestDevices()

CL_DLL void clCDeviceLocator_RequestDevices ( clCDeviceLocator locator,
clCDeviceType deviceType,
int32_t searchTime,
clCError * error )

Find available devices. Search time is in seconds. Searches for available devices of chosen type. Non-blocking - OnDevices event is fired when timeout expires.

Parameters
locatordevice locator handle
deviceTypedevice type
searchTimesearch time in seconds
errorout parameter for error

◆ clCDeviceLocator_SetOnDeviceListEvent()

CL_DLL void clCDeviceLocator_SetOnDeviceListEvent ( clCDeviceLocator locator,
clCDeviceLocator_DeviceListHandler handler )

Subscribe for device list

Parameters
locatordevice locator handle

◆ clCDeviceLocator_StopScanning()

CL_DLL void clCDeviceLocator_StopScanning ( clCDeviceLocator locator,
clCError * error )

Stop scanning for devices. OnDevices event may not be fired.

Parameters
locatordevice locator handle
errorout parameter for error

◆ clCDeviceLocator_Update()

CL_DLL void clCDeviceLocator_Update ( clCDeviceLocator locator)

This function should ONLY be called in single-threaded mode. In this mode it should be called periodically from the main thread to fire event callbacks.

Parameters
locatordevice locator handle